package com.etc.dao;

import com.etc.entity.ShopCar;
import com.etc.entity.ShopCarExample;
import com.etc.entity.ShopCarKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ShopCarMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    long countByExample(ShopCarExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    int deleteByExample(ShopCarExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    @Delete({
        "delete from shop_car",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ShopCarKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    @Insert({
        "insert into shop_car (id, w_id, ",
        "u_id, number, total_price, ",
        "s_name, s_price, s_color, ",
        "s_image)",
        "values (#{id,jdbcType=INTEGER}, #{wId,jdbcType=INTEGER}, ",
        "#{uId,jdbcType=INTEGER}, #{number,jdbcType=INTEGER}, #{totalPrice,jdbcType=VARCHAR}, ",
        "#{sName,jdbcType=VARCHAR}, #{sPrice,jdbcType=VARCHAR}, #{sColor,jdbcType=VARCHAR}, ",
        "#{sImage,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ShopCar record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    int insertSelective(ShopCar record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    List<ShopCar> selectByExample(ShopCarExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, w_id, u_id, number, total_price, s_name, s_price, s_color, s_image",
        "from shop_car",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.etc.dao.ShopCarMapper.BaseResultMap")
    ShopCar selectByPrimaryKey(ShopCarKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") ShopCar record, @Param("example") ShopCarExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") ShopCar record, @Param("example") ShopCarExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(ShopCar record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table shop_car
     *
     * @mbg.generated
     */
    @Update({
        "update shop_car",
        "set w_id = #{wId,jdbcType=INTEGER},",
          "u_id = #{uId,jdbcType=INTEGER},",
          "number = #{number,jdbcType=INTEGER},",
          "total_price = #{totalPrice,jdbcType=VARCHAR},",
          "s_name = #{sName,jdbcType=VARCHAR},",
          "s_price = #{sPrice,jdbcType=VARCHAR},",
          "s_color = #{sColor,jdbcType=VARCHAR},",
          "s_image = #{sImage,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ShopCar record);
}